<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>benny-sdl-classes: include/Vec2D.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">benny-sdl-classes
   
   </div>
   <div id="projectbrief">Benny&#39;s assorted SDL game classes. Does exactly what it says on the can.</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_vec2_d_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">include/Vec2D.h</div>  </div>
</div>
<div class="contents">
<a href="_vec2_d_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">     Copyright (C) 2011 Benny Mackney</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">    This program is free software: you can redistribute it and/or modify</span>
<a name="l00005"></a>00005 <span class="comment">    it under the terms of the GNU General Public License as published by</span>
<a name="l00006"></a>00006 <span class="comment">    the Free Software Foundation, either version 3 of the License, or</span>
<a name="l00007"></a>00007 <span class="comment">    (at your option) any later version.</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">    This program is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00012"></a>00012 <span class="comment">    GNU General Public License for more details.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">    You should have received a copy of the GNU General Public License</span>
<a name="l00015"></a>00015 <span class="comment">    along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00016"></a>00016 <span class="comment">*/</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">#ifndef VEC2D_H</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define VEC2D_H</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &quot;<a class="code" href="bennysc_8h.html">bennysc.h</a>&quot;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;math.h&gt;</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 
<a name="l00025"></a><a class="code" href="class_vec2_d.html">00025</a> <span class="keyword">class </span><a class="code" href="class_vec2_d.html">Vec2D</a>
<a name="l00026"></a>00026 {
<a name="l00027"></a>00027     <span class="keyword">public</span>:
<a name="l00029"></a>00029         <a class="code" href="class_vec2_d.html#aa3e3abb842bff81c10e8539c1689d578" title="Constructor of zero/null vector.">Vec2D</a>();
<a name="l00031"></a>00031         <a class="code" href="class_vec2_d.html#aa3e3abb842bff81c10e8539c1689d578" title="Constructor of zero/null vector.">Vec2D</a>(<span class="keywordtype">double</span> newX, <span class="keywordtype">double</span> newY);
<a name="l00032"></a>00032         <span class="keyword">virtual</span> <a class="code" href="class_vec2_d.html#a3609128b9388f58c9feff47b7c2dccc1">~Vec2D</a>();
<a name="l00033"></a>00033         <span class="comment">//Operators</span>
<a name="l00035"></a>00035 <span class="comment"></span>        <a class="code" href="class_vec2_d.html">Vec2D</a> &amp; <a class="code" href="class_vec2_d.html#ac2f6f4b13ebb48047ff6221be58a955e" title="Adds another vector to this one.">operator+=</a>(<span class="keyword">const</span> <a class="code" href="class_vec2_d.html">Vec2D</a> &amp;other);
<a name="l00037"></a>00037         <a class="code" href="class_vec2_d.html">Vec2D</a> &amp; <a class="code" href="class_vec2_d.html#a3019d889cad0f06b9b825c27a75129b9" title="Subtracts another vector from this one.">operator-=</a>(<span class="keyword">const</span> <a class="code" href="class_vec2_d.html">Vec2D</a> &amp;other);
<a name="l00039"></a>00039         <a class="code" href="class_vec2_d.html">Vec2D</a> &amp; <a class="code" href="class_vec2_d.html#afbd94c526ddab473036a364e77fc0ccc" title="Used to add two vectors.">operator+</a>(<span class="keyword">const</span> <a class="code" href="class_vec2_d.html">Vec2D</a> &amp;other);
<a name="l00041"></a>00041         <a class="code" href="class_vec2_d.html">Vec2D</a> &amp; <a class="code" href="class_vec2_d.html#a4aedacef15cfedcb1bd02d450c64dbf5" title="Used to subtract two vectors.">operator-</a>(<span class="keyword">const</span> <a class="code" href="class_vec2_d.html">Vec2D</a> &amp;other);
<a name="l00042"></a>00042         <span class="comment">//const funcs</span>
<a name="l00044"></a>00044 <span class="comment"></span>        <span class="keywordtype">double</span> <a class="code" href="class_vec2_d.html#a562d2b2013f9c9de6074b580fd60322a" title="Returns the length of the vector.">length</a>() <span class="keyword">const</span>;
<a name="l00046"></a>00046 
<a name="l00049"></a>00049         <span class="keywordtype">double</span> <a class="code" href="class_vec2_d.html#a8fa552d3f81b545407818594ba951160" title="Returns the squared length of the vector.">length2</a>() <span class="keyword">const</span>;
<a name="l00051"></a>00051 
<a name="l00054"></a>00054         <span class="keywordtype">double</span> <a class="code" href="class_vec2_d.html#a653e51f289c5753e092bfd32b968a660" title="Returns the angle the vector is pointing.">angle</a>() <span class="keyword">const</span>;
<a name="l00056"></a>00056         <span class="keywordtype">double</span> <a class="code" href="class_vec2_d.html#a344eb1026c248d3387e37c8b0d665cb6" title="Returns the x value of the vector.">get_x</a>() <span class="keyword">const</span>;
<a name="l00058"></a>00058         <span class="keywordtype">double</span> <a class="code" href="class_vec2_d.html#a847fe3cf2160f1e48c8f706630772da8" title="Returns the y value of the vector.">get_y</a>() <span class="keyword">const</span>;
<a name="l00059"></a>00059         <span class="comment">//nonconst funcs</span>
<a name="l00061"></a>00061 <span class="comment"></span>        <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keywordtype">double</span> newX, <span class="keywordtype">double</span> newY);
<a name="l00063"></a>00063         <span class="keywordtype">void</span> <a class="code" href="class_vec2_d.html#a4b0ad9b4ab63be55a3e2b515f9bf43d1" title="Multiplies the length of the vector.">scale</a>(<span class="keywordtype">double</span> multiplier);
<a name="l00065"></a>00065         <span class="keywordtype">void</span> <a class="code" href="class_vec2_d.html#a196e11d8fb45d75ba64fbd43550d4913" title="Scales the vector so that it becomes endLength long.">scale_to</a>(<span class="keywordtype">double</span> endLength);
<a name="l00066"></a>00066     <span class="keyword">protected</span>:
<a name="l00067"></a>00067     <span class="keyword">private</span>:
<a name="l00068"></a>00068         <span class="keywordtype">double</span> x;
<a name="l00069"></a>00069         <span class="keywordtype">double</span> y;
<a name="l00070"></a>00070 };
<a name="l00071"></a>00071 
<a name="l00072"></a>00072 <span class="preprocessor">#endif // VEC2D_H</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_vec2_d_8h.html">Vec2D.h</a>      </li>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">Generated on Sun Oct 23 2011 04:30:01 for benny-sdl-classes by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
